<?php


class SendBackException extends Exception {}

class FWerrorException extends Exception {}

class MissingParamsException extends Exception {
	
	private $_paramsList;
	
	
	public function __construct() {
		
		$args = func_get_args();
		if (is_array($args[0])) {
			$this->_paramsList = $args[0];
		} else {
			$this->_paramsList = $args;
		}
		
		$msg = "Missing Params : ";
		$msg .= implode(' ,', $this->_paramsList);
		
		parent::__construct($msg);	
		
	}
	
	
}

class TypeException extends Exception {
	
	const UNHANDLED 	= 1;
	const UNDEFINED 	= 2;
	const DEFINED		= 3;
	const DEFINITION	= 4;

	public function __construct($type, $code, $msg = '') {

		switch ($code) {
		
			case self::UNHANDLED:
				parent::__construct('Unhandled type: '.$type, $code); break;
			case self::UNDEFINED:
				parent::__construct('Undefined type: '.$type, $code); break;
			case self::DEFINED:
				parent::__construct('Can not define type '.$type.' : already defined', $code); break;
			case self::DEFINITION:
				parent::__construct('Definition of '.$type.': '.$msg, $code); break;
			
		}

	}
}

class TypeMismatchException extends Exception {
	public function __construct($msg = '') {
		parent::__construct('Type mismatch: '.$type);
	}
}


class goBackException extends Exception {}
class reloadBackException extends Exception {}
class refreshException extends Exception{}

class DBException extends Exception{}

?>
